package com.youyi.yyviewsdklibrary.Dialog.impl;

import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.transition.ChangeBounds;
import android.transition.Fade;
import android.transition.TransitionManager;
import android.transition.TransitionSet;
import android.view.View;
import android.widget.TextView;
import com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView;
import com.youyi.yyviewsdklibrary.Dialog.util.XPopupUtils;
import com.lkx.liandianqinew.R;

public class LoadingPopupView extends CenterPopupView {
    private boolean first = true;
    private CharSequence title;
    private TextView tv_title;

    public LoadingPopupView(Context context, int i) {
        super(context);
        this.bindLayoutId = i;
        addInnerContent();
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public int getImplLayoutId() {
        return this.bindLayoutId != 0 ? this.bindLayoutId : R.layout._xpopup_center_impl_loading;
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void onCreate() {
        super.onCreate();
        this.tv_title = (TextView) findViewById(R.id.tv_title);
        if (Build.VERSION.SDK_INT >= 21) {
            getPopupImplView().setElevation(10.0f);
        }
        if (this.bindLayoutId == 0) {
            getPopupImplView().setBackground(XPopupUtils.createDrawable(Color.parseColor("#CF000000"), this.popupInfo.borderRadius));
        }
        setup();
    }

    /* access modifiers changed from: protected */
    public void setup() {
        if (this.tv_title != null) {
            post(new Runnable() {
                /* class com.youyi.yyviewsdklibrary.Dialog.impl.LoadingPopupView.AnonymousClass1 */

                public void run() {
                    if (!LoadingPopupView.this.first) {
                        TransitionManager.beginDelayedTransition(LoadingPopupView.this.centerPopupContainer, new TransitionSet().setDuration((long) LoadingPopupView.this.getAnimationDuration()).addTransition(new Fade()).addTransition(new ChangeBounds()));
                    }
                    LoadingPopupView.this.first = false;
                    if (LoadingPopupView.this.title == null || LoadingPopupView.this.title.length() == 0) {
                        LoadingPopupView.this.tv_title.setVisibility(View.GONE);
                        return;
                    }
                    LoadingPopupView.this.tv_title.setVisibility(View.VISIBLE);
                    LoadingPopupView.this.tv_title.setText(LoadingPopupView.this.title);
                }
            });
        }
    }

    public LoadingPopupView setTitle(CharSequence charSequence) {
        this.title = charSequence;
        setup();
        return this;
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void onDismiss() {
        super.onDismiss();
        TextView textView = this.tv_title;
        if (textView != null) {
            textView.setText("");
            this.tv_title.setVisibility(View.GONE);
        }
    }
}
